package com.devtty.collabhr;

import javax.enterprise.context.SessionScoped;

import com.devtty.collabhr.model.Call;
import com.devtty.collabhr.ui.MainWindow;
import com.devtty.collabhr.ui.QuickCallWindow;
import com.vaadin.Application;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Label;
import com.vaadin.ui.Window;

@SuppressWarnings("serial")
@SessionScoped
public class MyVaadinApplication extends Application
{
	
	
    private Window window;

    //@PersistenceContext(unitName="primary")
    //private EntityManager em;
    
    @Override
    public void init()
    {  	
    	
        window = new Window("My Vaadin Application");
        
        setMainWindow(new MainWindow());
        //setMainWindow(window);
        Button button = new Button("Click Me");
        button.addListener(new Button.ClickListener() {
            public void buttonClick(ClickEvent event) {
                window.addComponent(new Label("Thank you for clicking"));
                Call c = new Call();
                c.setPhone("222");
                c.setCreated(new java.util.Date());
                
      //          em.persist(c);
            }
        });
        window.addComponent(button);
        //window.addComponent(new QuickCallWindow());
        
     }
       
}
